package own.stu.jobgib.playown.spi;

import sun.misc.Service;

import java.util.Iterator;
import java.util.ServiceLoader;

public class Demo {

    public static void main_2(String[] args) {
        Iterator<SPIService> providers = Service.providers(SPIService.class);
        ServiceLoader<SPIService> load = ServiceLoader.load(SPIService.class);

        while(providers.hasNext()){
            SPIService ser = providers.next();
            ser.execute();
        }

        System.out.println("--------------------------------");

        Iterator<SPIService> iterator = load.iterator();
        while (iterator.hasNext()){
            SPIService next = iterator.next();
            next.execute();
        }
    }

    public static void main(String[] args) throws ClassNotFoundException {
        System.out.println(" -------- ");
        Class<?> aClass = Class.forName("com.mysql.cj.jdbc.Driver");
        System.out.println(aClass.getName());
    }
}
